import { defineStore } from 'pinia';
import { createDiscreteApi } from 'naive-ui';

const {message} = createDiscreteApi(["message"]);

export const usemsgStore = defineStore('msgwrapper',{
    actions:{
        // 对信息提示二次封装
        sendMessage(type, content, options = {}) {
            switch (type) {
            case "success":
                message.success(content, options);
                break;
            case "error":
                message.error(content, options);
                break;
            case "loading":
                message.loading(content, options);
                break;
            case "info":
                message.info(content, options);
                break;
            default:
                message.info("异常消息", options);
            }
      }
    }
})